<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>获取元素文本内容</title>
</head>
<body>
<div class="container">容器</div>
<script>
  var ele = document.querySelector('.container');
  console.log(ele);
  //获取元素中的文本内容
  console.log(ele.innerText);
  //赋值新内容
  ele.innerText = "内容一";
</script>
</body>
</html>